<?php

class red extends bhCommon {


    /**
     * 领取红包
     */
    public function receive()
    {
        $id = $this->get('id');

        pdo_begin();
        try{
            $money = $this->bargain->receive($this->member['id'], $id);
            if (!$money) {
                throw new Exception($this->bargain->error);
            }
            pdo_commit();
            $this->json(array('red_money' => $money));
        } catch (Exception $e) {
            pdo_rollback();
            $this->json($e->getMessage(), 2);
        }
    }



}